isEmpty() method
This method will allow you to check if the provided string is empty or not. If the string length is zero then the method will return true else the false value will be returned.
Method implementation-
public boolean isEmpty() {
return value.length == 0;
}
Syntax-
public boolean isEmpty()
Example-
public class Simple{
public static void main(String[] args) {
String s1 = "welcome";
String s2="";
String s3=s1.intern();
System.out.println(s1.isEmpty());
System.out.println(s2.isEmpty());
}
}
Output-